#include "imx6ul.h"
#include "bsp_clk.h"
#include "bsp_led.h"
#include "bsp_beep.h"
#include "bsp_delay.h"
#include "bsp_key.h"
#include "bsp_gpio.h"

/*
 * @description	: mian函数
 * @param 		: 无
 * @return 		: 无
 */
int main(void)
{
	clk_enable(); /* 使能所有的时钟 			*/
	beep_init();  /* 初始化beep 			*/
	led_init();	  /* 初始化led 			*/
	key_init();
	led_switch(LED0, OFF);

	int keyvalue = 0;
	int i = 0;
	unsigned char led_state = OFF;
	unsigned char beep_state = OFF;

	while (1)
	{
		keyvalue = key_getvalue();

		if (keyvalue)
		{
			switch (keyvalue)
			{
			case KEY0_VALUE:
				/* code */
				beep_state = !beep_state;
				beep_switch(beep_state);
				break;

			default:
				break;
			}
		}
		if ((i++) == 50)
		{
			i = 0;
			led_state = !led_state;
			led_switch(LED0, led_state);
		}
		delay(10);
	}

	return 0;
}
